package com.naihe.anderson.sms.util;

import com.pinyin4android.PinyinUtil;

import android.content.Context;

public class Pinyin {

	public static String getPinYinHeadChar(String str, Context context) {
		String convert = "";
		if (str == null || str.equals(""))
			str = "";
		for (int j = 0; j < str.length(); j++) {
			char word = str.charAt(j);
			String pinying = PinyinUtil.toPinyin(context, word);
			if (pinying != null && pinying.length() > 0) {
				convert += pinying.charAt(0);
			} else {
				convert += word;
			}
		}
		return convert;
	}

}